package com.xxx.file;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/7/22 14:32
 * @Copyright 博为峰
 */
public class BufferedWriterDemo {
    public static void main(String[] args) {
//        FileWriter fileWriter = new FileWriter("a.txt");
//        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
//        bufferedWriter.write("abc");
//        bufferedWriter.newLine();
//        bufferedWriter.write("def");
//        bufferedWriter.close();

        try (FileWriter fileWriter = new FileWriter("./IO/buff.txt"); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);) {
            bufferedWriter.write("abc");
            bufferedWriter.newLine();
            bufferedWriter.write("def");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
